<template>
  <div>
    <el-container>
      <el-header
        ><el-menu
          :default-active="activeIndex"
          class="el-menu-demo"
          mode="horizontal"
          @select="handleSelect"
          ><el-row>
            <el-col :span="4"
              ><div class="grid-content bg-purple-dark">
                <el-menu-item index="1"><router-link to="/ShowProduct" tag="span" >产品</router-link></el-menu-item>
              </div></el-col
            >
            <el-col :span="4"
              ><div class="grid-content bg-purple-dark">
                <el-menu-item index="2">贷款推荐</el-menu-item>
              </div></el-col
            >
            <el-col :span="4"
              ><div class="grid-content bg-purple-dark">
                <el-menu-item index="3">信用卡服务</el-menu-item>
              </div></el-col
            >
            <el-col :span="4"
              ><div class="grid-content bg-purple-dark">
                <el-menu-item index="4">数字金融</el-menu-item>
              </div></el-col
            >
            <el-col :span="4"
              ><div class="grid-content bg-purple-dark">
                <el-menu-item index="5"><router-link to="/QuestionShow"  tag="span">常见问题</router-link></el-menu-item>
              </div></el-col
            >
            <el-col :span="2"
              ><div class="grid-content bg-purple-dark">
                <el-menu-item index="6">关于我们</el-menu-item>
              </div></el-col
            >
            <el-col :span="2"
              ><div class="grid-content bg-purple-dark">
                <el-submenu index="7">
                  <template slot="title" v-if="user == null"><div >请登录</div></template>
                  <template slot="title" v-if="user!= null"><div >{{user.userName}}</div></template>
                  <el-menu-item index="7-1"  > <router-link to="/UserShow"  tag="span">修改个人信息</router-link></el-menu-item>
                  <el-menu-item index="7-2"><router-link to="/Userinfo" tag="span">查看个人详情信息</router-link></el-menu-item>
                  <el-menu-item index="7-3"><router-link :to="'/Repay/'+user.userId"  tag="span">订单详情</router-link></el-menu-item>
                  <el-menu-item index="7-4"><router-link to="/Debit" tag="span">借款信息表</router-link></el-menu-item>
                  <el-menu-item index="7-5"><router-link to="/Document" tag="span">审核材料上传</router-link></el-menu-item>
                </el-submenu>
              </div>
            </el-col>
          </el-row>
        </el-menu></el-header>
      <el-main><router-view></router-view></el-main>
    </el-container>
  </div>
</template>
<script>
export default {
  data() {
    return {
      user:{},
      activeIndex: "1",
    };
  },
  methods: {
    
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  mounted(){
    this.user = JSON.parse(sessionStorage.getItem("user"));
  }
};

</script>
<style>
.el-header {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  line-height: 20px;
  height: anto;
}
.el-main {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  line-height: 20px;
  height: anto;
}


</style>